package org.jeecg.modules.demo.mall.yxmerchantstore.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.mall.entity.YxMerchantStore;
import org.jeecg.modules.demo.mall.entity.YxStoreProduct;
import org.jeecg.modules.demo.mall.yxmerchantstore.mapper.YxMerchantStoreMapper;
import org.jeecg.modules.demo.mall.yxmerchantstore.service.IYxMerchantStoreService;
import org.springframework.stereotype.Service;

import java.util.Arrays;

/**
 * @Description: 商家商品信息表
 * @Author: jeecg-boot
 * @Date:   2023-10-25
 * @Version: V1.0
 */
@Service
public class YxMerchantStoreServiceImpl extends ServiceImpl<YxMerchantStoreMapper, YxMerchantStore> implements IYxMerchantStoreService {

    @Override
    public void updateIsDel(YxStoreProduct yxStoreProduct) {
        Arrays.stream(yxStoreProduct.getDeletedIds()).forEach(s -> {
            UpdateWrapper<YxMerchantStore> queryWrapper = new UpdateWrapper<>();
            queryWrapper.eq("id",s.get("id"));
            queryWrapper.set("is_del",1);
            this.update(queryWrapper);
        });
    }
}
